﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if IE 6 ]><html class="ie6"><![endif]-->
<!--[if IE 7 ]><html class="ie7"><![endif]-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{config.webtitle}</title>
<meta content="{config.webkeyword}" name="keywords" />
<meta content="{config.webdescription}" name="description" />





  <!--css-->
<%template src="cssjs.html"%>
<!--/css-->

<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/ui-lightness/jquery.ui.core.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/ui-lightness/jquery.ui.theme.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/ui-lightness/jquery.ui.datepicker.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/tipsy.css">
</head>

<body>

<div class="wrapper">
  
  <!--Header-->
<%template src="_header.html"%>
<!--/Header-->
   
  
  <div id="page_modules">
    
    <div class="center_wrapper center_lineGreen clearfix">
      <div class="left_con_m">
        <div class="tile_left_m">
          <div class="tile_zh">订购您的排毒计划！</div>
          <div class="tile_en"><em class="black">Order</em><em class="darkGreen"> YOUR</em><em class="lightGreen">JUICEUP</em></div>
        </div>
        
        <div class="order_warp">
        
            <div class="order_step">
              <ul>
              <li class="selected">第一步：计划开始日期</li>
              <li>第二步：确认</li>
              <li>第三步：付款</li>
              </ul>
            </div>
            <div class="order_selected" id="tess">
              <span class="tile">您当前选择的是：</span>
              <span class="info"><em>{model.title}</em>{model.content}</span>
            </div>
            <div class="order_days">
              <span class="tile">选择排毒计划理想天数：</span>
              <ul class="order_days_select">
                <li><a href="javascript:void(0);"  class="tip <%if(starti==1)%>selected<%/if%>" title="JuiceUp建议排毒周期：<br/>每周排毒1-2次，每次1日" onClick="test(1)" >1</a></li>
                <li><a href="javascript:void(0);"  class="tip  <%if(starti==3)%>selected<%/if%>" title="JuiceUp建议排毒周期：<br/>每月排毒1-2次，每次连续3日"  onClick="test(3)" >3</a></li>
           <!--     <li><a href="javascript:void(0);" onClick="test(5)" >5</a></li>
                <li><a href="javascript:void(0);" onclick="test(7)" >7</a></li>-->
              </ul>
            </div>
            
            <div class="order_time_start clearfix">
              <div style="font-size: 18px;color: #e4007f; padding-bottom:30px;">我们会在您所选排毒日期前一天下午或晚上为您配送果汁</div>
              <span class="tile">请选择排毒日期</span>
              <div class="order_time_Date">
                <div id="datepicker"></div>
              </div>
            </div> 
             
           <!-- <div class="order_time_week">
                <a class="previous" id="previousweek" onClick="previousWeek();">&lt;上一周</a>
                <span id="showdate"></span>
                <a class="next" onClick="nextWeek();">下一周&gt;</a>
            </div>
            <!--显示日期-->
            <!--<div class="myOrderCalendarWarp">
              <div id="mytable" class="myOrderCalendar"></div>
            </div>-->
            
        </div>
        
      </div>
      <div class="right_con_m">
        <p class="hotLineRight">欢迎拨打<br />JuiceUp 客服热线：<br />400-082-5955<br />
										（工作日9:00am-6:00pm）</p>
        <div class="orderConf">
          <h5>确认您的订单：</h5>
          <div class="price">产品：¥ <span id="price">0</span> RMB</div>
          <div class="shipping">运费：¥ 0 RMB</div>
          <div class="total">总价：¥ <span id="price1">0</span> RMB</div>
          <div class="btn_next"><a    href="javascript:goodconfirm()">下一步</a></div>
        </div>
               <!--right-->
<%template src="right.html"%>
<!--/right-->
      </div>
    </div>
    
  </div>
 


 <script src="<%templateskin%>/js/jquery.simpletip-1.3.1.min.js"></script>

 <script src="<%templateskin%>/js/jquery.ui.datepicker.js"></script>
<script src="<%templateskin%>/js/jquery.ui.datepicker-zh-TW.js"></script>
<script type="text/javascript">
    $(function () {

        $('.tip').tipsy();

   

    });
</script>
<script type="text/javascript" src="<%templateskin%>/js/cart1.js"></script>
  <script type="text/javascript" src="<%templateskin%>/js/json2.js"></script>  
 
  <script type="text/javascript">
    Date.prototype.Format = function (fmt) { //author: meizz 
		        var o = {
		            "M+": this.getMonth() + 1, //月份 
		            "d+": this.getDate(), //日 
		            "h+": this.getHours(), //小时 
		            "m+": this.getMinutes(), //分 
		            "s+": this.getSeconds(), //秒 
		            "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		            "S": this.getMilliseconds() //毫秒 
		        };
		        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
		        for (var k in o)
		            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
		        return fmt;
		    }
   var dateall=[];
function dateadd(date,i)
{
for(var j=0; j<i;j++) {
    dateall.push(new  Date(date.setDate(date.getDate() + 1)));
}
}
  function tests(datep,type,i) {
    if(dateall.length==0)
    {
    var setdate = new Date();
    
    
      if(type==3)
    {
    setdate.setFullYear(2015, 1, 17);
     dateadd(setdate, 9+i);
    }else
    {
     setdate.setFullYear(2015, 1, 19);
      dateadd(setdate, 7+i);
    }
     if(type==3)
    {
    setdate.setFullYear(2015, 3, 2);
     dateadd(setdate, 5+i);
    }else
    {
     setdate.setFullYear(2015, 3, 4);
      dateadd(setdate, 3+i);
    }
      if(type==3)
    {
    setdate.setFullYear(2015, 3, 29);
     dateadd(setdate, 5+i);
    }else
    {
     setdate.setFullYear(2015, 4, 1);
      dateadd(setdate, 3+i);
    }
       if(type==3)
    {
    setdate.setFullYear(2015, 5, 18);
     dateadd(setdate, 5+i);
    }else
    {
     setdate.setFullYear(2015, 5, 20);
      dateadd(setdate, 3+i);
    }
   
   
   }
    for (var i=0; i<dateall.length; i++)
    {
        if (new Date(dateall[i]).Format("yyyy-MM-dd") == datep.Format("yyyy-MM-dd")) {
            return true;
        }
       
       // alert(new Date(dateall[i]).Format("yyyy-MM-dd"));

    }
    return false;
}
function testwile(type) {
	        var myDate = new Date();

	        if (new Date().getHours() < 14) {
	            myDate.setDate(myDate.getDate() + 2);
	        }
	        else {
	            myDate.setDate(myDate.getDate() + 3);
	        }
	        if (type == 3) {
	            while (selectedDate(myDate, 3, 0)[0] == false) {
	                myDate.setDate(myDate.getDate() + 1);
	            }
	        }
	        else
	        {
	          while (selectedDate(myDate, 1, 0)[0] == false) {
	                myDate.setDate(myDate.getDate() + 1);
	            }
	        }
	        
	       return myDate;
	        
	    }
		    var starti = {starti};
            var jiazhi=2;
		    var currDT=testwile(starti);
		    var aryDay = new Array("日", "一", "二", "三", "四", "五", "六"); //显示星期  
		    var lastDay; //页面显示的最后一天
		    var firstDay; //页面显示的第一天
            var Selecttime=[];
		    //初始化日期加载
		    function initDate(myDates) {
		        currDT = myDates;
		        tempDate = myDates;
		        minDatetime = new Date();
		        minDatetime.setDate(minDatetime.getDate() + 2);
		       
		        setcontent("a");
		        
		      

		    }
		  
		
		     Data = [];
           
		    var type = <%=id %>; //类别
            <%set DataTable goods_list=get_article_list("goods", 0, 10, "id="+id, "id desc")%>
var plist=[<%loop dr goods_list%>{ "id": {dr[id]},"q": 1,"j":{dr[sell_price]}}<%if(dr__loop__id!=goods_list.Rows.Count)%>,<%/if%><%/foreach%>];
          
		    function setcontent(Days) {
		        if (Days == "a") {

                var order_amount=0;
		            var d = new Date(currDT);

		            Data.length = 0;
		            for (var j = 0; j < starti; j++) {

		               var s = j == 0 ? 0 : 1;

 Data.push({ "id": j, g: [], "e": d.setDate(d.getDate() +s), "t": 3 ,"a":0,"s":0});
                       
		                for (var h = 0; h < plist.length; h++) {
		                    Data[j].g.push(plist[h]);
                            order_amount=Number(order_amount+plist[h].j);
		                }
		            }
                   if(starti==3)
                   {
                   order_amount=980;
                   } 
                    $("#price").text(order_amount)
                    $("#price1").text(order_amount)
		        }
                
 
		       

		    }
		  
		    
		   
           

function selectedDate(date, type, i,currDTt) {



    var d = date.getDay();
    var ret=[true,'hasCourse'];
    if (tests(date, type, i)) {
    ret=[false, 'noCourse'];
    }
    if (type == 3) {
        if (d == 0 || d == 6||d == 1) {
          ret=[false, 'noCourse'];

        }
    }
    else {
        if (d == 1) {
            ret=[false, 'noCourse'];

        }
        
    }
    
    if (date.Format("yyyy-MM-dd") =='2015-01-05') {
          ret=[true,'hasCourse'];
        }
    //alert(currDTt);
   if(jiazhi==3)
   {
  if(currDT)
  {
  if(type==3)
    {
 // alert(currDT);
   var newcurrDT=new Date(currDT);
    newcurrDT.setDate(newcurrDT.getDate() +jiazhi);
    
   if(currDT<=date&&date<newcurrDT)

 {
    ret[1]="selCourse";
    }
    
    
    }
    
   
    else
    {
    if(currDT.Format("yyyy-MM-dd") == date.Format("yyyy-MM-dd"))

 {
    ret[1]="selCourse";
    }
    }
     }
     }
    return ret;
}
</script>   
	<script  type="text/javascript">

	    $(function () {
	

	        $("#datepicker").datepicker({ "minDate": currDT,
	            showOtherMonths: true,
	            selectOtherMonths: true,
	            //beforeShowDay: $.datepicker.noWeekends,

	            onSelect: function (date) {
	               // alert(1);
	                // $("#datepicker").datepicker('option', "beforeShowDay", null);
	                jiazhi = 3;
	                initDate(new Date(date));


	            },
	            beforeShowDay: function (date) {
	                //alert(2);

	                return selectedDate(date, starti, 0, new Date(currDT));


	            }
	        });


	    });
	    function test(v) {
	        location.href = "goods_show.aspx?id={id}&starti=" + v + "#tess";
	    }
	    
	</script>

     <script type="text/javascript">
  
 
      function goodconfirm() {
          if (Data.length == 0) {
              $.dialog.alert("对不起，请先选择您的排毒计划！");
          }
          else {
              $("#conlist").html("");
              for (var i = 0; i < Data.length; i++) {
              if(Data.length!=1)
              {
                  var newjihua = new Date(Data[i].e);
                  newjihua.setDate(newjihua.getDate()-1);
                  $("#conlist").append("<p>第" + (i + 1) + "天排毒果汁送达日期:<b>" + newjihua.Format("yyyy-MM-dd") + "</b></p>");
                  }else
                  {
                  var newjihua = new Date(Data[i].e);
                  newjihua.setDate(newjihua.getDate()-1);
                  $("#conlist").append("<p>排毒果汁送达日期:<b>" + newjihua.Format("yyyy-MM-dd") + "</b></p>");
                  }
              }




              var obj = $("#confirm1");
            
               var dialog = $.dialog({
               id:"sportdg",
               title: '确认订单',
               content: obj.clone().show(),
                   min: false,
                   max: false,
                  lock: true
               });
          }
       }
      function hidedg(){
	$.dialog({id:'sportdg'}).close();
	    //$('#sportdg').dialog("close");
	}
  </script>

  <div class="layer_warp"  style="display:none;" id="confirm1">
  
  <div class="layer_giftCard">
   
    <div class="gc_right_con">
      <p>您当前选择的是:<b>{model.title}</b></p>
      <span id="conlist">
     </span>
      <div class="btnWarp"><a class="btn btnRed" href="javascript:hidedg();">我想重新选择</a><a class="btn" href="javascript:void(0);" onclick="CartAdd(this, '{config.webpath}', 1, '<%linkurl("shopping","confirm")%>');">确认提交</a></div>
    </div>
  </div>
</div>

     
 
<!--Footer-->
<%template src="_footer.html"%>
<!--/Footer-->
